package org.budo.support.java.io.util;

import java.io.IOException;
import java.io.RandomAccessFile;

/**
 * @author limingwei
 * @date 2016年6月12日 上午9:41:22
 */
public class RandomAccessFileUtil {
    public static void seek(RandomAccessFile randomAccessFile, long seek) {
        try {
            randomAccessFile.seek(seek);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static String readLine(RandomAccessFile randomAccessFile) {
        try {
            return randomAccessFile.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static void close(RandomAccessFile randomAccessFile) {
        try {
            randomAccessFile.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    public static String readUTF(RandomAccessFile randomAccessFile) {
        try {
            return randomAccessFile.readUTF();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}